package com.kuangstudy.controller;

import com.kuangstudy.entity.User;
import com.kuangstudy.service.focus.AttentionService;
import com.kuangstudy.service.togetherfriend.TogetherFriendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author panghu
 * @version 1.0.0
 * @createTime 2023年09月18日 20:26:00
 * @Description
 */
@RestController
@Api(tags = "关注取消关注业务")
public class AttentionController {

    @Autowired
    private AttentionService attentionService;

    @Autowired
    private TogetherFriendService togetherFriendService;


    @PostMapping("/user/follow")
    @ApiOperation("关注")
    public String follow(@RequestParam Long userId, @RequestParam Long followId) {
        String follow = attentionService.follow(userId, followId);
        return follow;
    }


    @PostMapping("/user/unfollow")
    @ApiOperation("取消关注")
    public String unFollow(@RequestParam Long userId, @RequestParam Long followId) {
        String unFollow = attentionService.unFollow(userId, followId);
        return unFollow;
    }


    @PostMapping("/user/toggle/friends")
    @ApiOperation("共同关注好友")
    public List<User> toggleFriends(@RequestParam Long userId1, @RequestParam Long userId2) {
        List<User> userList = togetherFriendService.together(userId1, userId2);
        return userList;
    }


    @PostMapping("/user/selectMyFocusList")
    @ApiOperation("查询我的关注列表")
    public List<User> selectMyFocusList(@RequestParam Long userId) {
        List<User> userList = attentionService.selectMyFocusList(userId);
        return userList;
    }


    @PostMapping("/user/selectMyFansList")
    @ApiOperation("查询我的粉丝列表")
    public List<User> selectMyFansList(@RequestParam Long userId) {
        List<User> userList = attentionService.selectMyFansList(userId);
        return userList;
    }

}
